

#include<windows.h>
#include<iostream>
#include"mem_util.h"

using namespace std;

int main(){
	
	xy::MapMemory m(false,nullptr,0,1024);
	
	int* d = m.data<int*>();
	d[0] = 100;
	
	cout << d[0] << endl;
	
	xy::File f("test2.txt");
	xy::MapMemory m2(false,nullptr,0,1024,&f);
	
	int* d2 = m2.data<int*>();
	
	d2[1]=100;
	cout << d2[1] << endl;
	
	
	DWORD64 *d3 = m2.data<DWORD64*>();
	d3[0] = 999;
	cout << d3[0] << endl;
	cout << d2[0] <<endl;
	cout << d2[1] <<endl;
	
	char *s = m2.data<char*>();
	for(int i=0;i<1024;i++){
		s[i] = 'A';
	}
	
	xy::File f2("test3.txt");
	xy::MapMemory m4(false,"cpp",0,100*sizeof(int));
	auto d4 = m4.data<int*>();
	for(int i=0;i<100;i++){
		d4[i] = 'B';
	}
	
	
	getchar();
	
	return 0;
}


